<template>
    <div class="box">
      <div class="top">
        <span class="title">{{name}}</span>
    <!--    <span @click="$router.push('/course')">查看全部</span> -->    
  </div>
      <div class="list">
        <div class="item" v-for="(item, index) of items" :key="index"
             @click="$router.push({path:'/Course_info',query:{'id':item.id}})">
          <img :src="item.cover" alt="">
          <div class="info">
            <p class="name">{{item.name}}</p>
        <!--      <p class="price">￥{{item.price/100}}</p>-->    
          </div>
        </div>
      </div>
    </div>
</template>

<script>
export default {
  name: 'home-item',
  props: {
    name: {
      type: String
    },
    items: {
      type: Array,
      default: function () {
        return []
      }
    }
  }
}
</script>

<style scoped>
.box{
  border-bottom: .2rem solid #f2f2f2;
}
.top{
  display: flex;
  justify-content: space-between;
  height: 1.2rem;
  align-items: center;
  padding: 0 .4rem;
}
.top span.title{
  font-size: .48rem;
  font-weight: bold;
  color: #0959c8;
  padding-left: 5px;
  position: relative;
}
.top span.title::before{
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 2px;
  left: 0;
  background: #007aff;
  content: '';
}
.top span{
  font-size: .36rem;
}
.list{
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 0 .3rem;
}
.item{
  width: 48%;
  margin-bottom: .3rem;
}
.item img{
  display: block;
  width: 100%;
}
.item .name{
  font-size: .4rem;
  margin-top: .1rem;
  color: #333;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.item .price{
  color: #ed702d;
  font-size: .42rem;
}
</style>
